<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<!--<![endif]-->
<head>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>人人为我，我为人人</title>

<link rel="shortcut icon" href="images/favicon.png" />

<!-- Style Sheet-->

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<link rel="stylesheet" href="css/style.css" />
<link rel='stylesheet' id='bootstrap-css-css'
	href='css/bootstrap5152.css?ver=1.0' type='text/css' media='all' />
<link rel='stylesheet' id='responsive-css-css'
	href='css/responsive5152.css?ver=1.0' type='text/css' media='all' />
<link rel='stylesheet' id='pretty-photo-css-css'
	href='js/prettyphoto/prettyPhotoaeb9.css?ver=3.1.4' type='text/css'
	media='all' />
<link rel='stylesheet' id='main-css-css' href='css/main5152.css?ver=1.0'
	type='text/css' media='all' />
<link rel='stylesheet' id='custom-css-css'
	href='css/custom5152.html?ver=1.0' type='text/css' media='all' />
<script type='text/javascript' src='js/jquery.easing.1.3.js'></script>
<script type='text/javascript'
	src='js/prettyphoto/jquery.prettyPhoto.js'></script>
<script type='text/javascript' src='js/jflickrfeed.js'></script>
<script type='text/javascript' src='js/jquery.liveSearch.js'></script>
<script type='text/javascript' src='js/jquery.form.js'></script>
<script type='text/javascript' src='js/jquery.validate.min.js'></script>
<script type='text/javascript' src='js/custom.js'></script>
<script src="layer.js"></script>
<script src="layui.js"></script>
<link rel="stylesheet" href="css/layui.css" media="all">

</head>

<body>

	<!-- Start of Header -->
	<div class="header-wrapper">
		<header>
			<div class="container">


				<div class="logo-container">
					<!-- Website Logo -->
					<a href="index-2.html" title="解惑,是我们的乐趣!"> <!--<img src="images/logo.png" alt="Knowledge Base Theme">-->
						<h3 style="display: inline; color: #FFFFFF; line-height: 20px;">知之</h3>
					</a> <span class="tag-line">知之为知之,不知为不知,是知也。</span>
				</div>


				<!-- Start of Main Navigation -->
				<nav class="main-nav">
					<div class="menu-top-menu-container">
						<ul id="menu-top-menu" class="clearfix">
							<li><a href="index-2.html">首页</a></li>
							<li><a href="home-categories-description.html">百科</a></li>
							<li><a href="home-categories-articles.html">Java基础</a></li>
							<li><a href="articles-list.html">数据库</a></li>
							<li><a href="faq.html">FAQs</a></li>
							<li><a href="#">皮肤</a>
								<ul class="sub-menu">
									<li><a href="blue-skin.html">Blue Skin</a></li>
									<li><a href="green-skin.html">Green Skin</a></li>
									<li><a href="red-skin.html">Red Skin</a></li>
									<li><a href="index-2.html">Default Skin</a></li>
								</ul></li>
							<li><a href="#">更多精彩</a>
								<ul class="sub-menu">
									<li><a href="full-width.html">Full Width</a></li>
									<li><a href="elements.html">Elements</a></li>
									<li><a href="page.html">Sample Page</a></li>
								</ul></li>
							<li><a href="contact.html">联系我们</a></li>
							<li><a id="tourist" href="#"></a></li>
							<li><a id="topLogin" href="#">登录</a>
								<ul id="topUserIfm" class="sub-menu">
									<li><a href="blue-skin.html">个人信息</a></li>
									<li><a id="switchUser" href="#">切换账号</a></li>
									<li><a href="QuestionTopServlet?op=exitTopUser">退出</a></li>
								</ul></li>
							<li><a id="topRegister" href="#">注册</a></li>
						</ul>
					</div>
				</nav>
				<!-- End of Main Navigation -->

			</div>
		</header>
	</div>
	<!-- End of Header -->

	<!-- Start of Search Wrapper -->
	<div class="search-area-wrapper">
		<div class="search-area container">
			<h3 class="search-header">解惑,我们是专业的!</h3>
			<p class="search-tag-line">请输入要查询的问题!</p>

			<form id="search-form" class="search-form clearfix" method="get"
				action="#" autocomplete="off">
				<input class="search-term required" list="dl" type="text" id="nameLikeAnswer" value="${nameLike==null?"":nameLike}"
					name="nameLike" placeholder="请输入..." title="* Please enter a search term!" />
				<datalist id="dl">
					<option value="java多继承" label="java"></option>
					<option value="java线程" label="java"></option>
					<option value="java序列化" label="java"></option>
					<option value="HTML5" label="前端"></option>
				</datalist>
				<input id="btnSearchAnswer" class="search-btn" type="button" value="嗖一下" />
				<div id="search-error-container"></div>
			</form>
		</div>
	</div>
	<!-- End of Search Wrapper -->

	<!-- Start of Page Container -->
	<div class="page-container">
		<div class="container">
			<div class="row">

				<!-- start of page content -->
				<div class="span8 page-content">

					<ul class="breadcrumb">
						<li><a href="#">你好</a><span class="divider">/</span></li>
						<li><a href="#"
							title="View all posts in Server &amp; Database">
								这里展示问题</a> <span class="divider">/</span></li>
						<li class="active">你可以尽情的回答问题哦！！</li>
					</ul>

					<article class=" type-post format-standard hentry clearfix">
					<c:if test="${pdQid.data.size()<1}">
					         <h1 class="post-title">
							<a href="#">${pdNo.data[0].qTitle}</a><span id="star" style="float: right;"></span>
						</h1>
						

						<div class="post-meta clearfix">
							<span class="date">${pdNo.data[0].qDate}</span> <span class="category"><a
								href="#" title="View all posts in Server &amp; Database">${pdNo.data[0].userName}</a></span> <span class="comments"><a href="#"
								title="Comment on Integrating WordPress with Your Website">收到的消息</a></span> <span style="cursor: pointer;" class="like-count praiseQuestion">${pdNo.data[0].qPraise}</span>
						</div>
						<!-- end of post meta -->

						<h3 style="text-indent: 2em;">${pdNo.data[0].qContent}</h3>
                        <hr>
					 </c:if>
                     <c:if test="${pdQid.data.size()>0}">
						<h1 class="post-title">
							<a href="#">${pdQid.data[0].qTitle}</a><span id="star" style="float: right;"></span>
						</h1>

						<div class="post-meta clearfix">
							<span class="date">${pdQid.data[0].qDate}</span> <span class="category"><a
								href="#" title="View all posts in Server &amp; Database">${pdQid.data[0].userName}</a></span> <span class="comments"><a href="#"
								title="Comment on Integrating WordPress with Your Website">收到的消息</a></span> <span class="like-count praiseQuestion">${pdNo.data[0].qPraise}</span>
						</div>
						<!-- end of post meta -->

						<h3 style="text-indent: 2em;">${pdQid.data[0].qContent}</h3>
                        <hr>
                    </c:if>
					</article>

					<div class="like-btn">

						<form id="like-it-form" action="#" method="post">
							<span class="like-it ">66</span> <input type="hidden"
								name="post_id" value="99"> <input type="hidden"
								name="action" value="like_it">
						</form>

						<span class="tags"> <strong>类型:&nbsp;&nbsp;</strong><a
							href="#" rel="tag">java</a>, <a href="#" rel="tag">php</a>,
							<a href="#"
							rel="tag">c</a>
						</span>
						<p>您的回答被采纳后将获得：系统奖励(财富值+成长值)</p>

					</div>

					<section id="comments">

						<ol class="commentlist">
						<c:if test="${pdQid.data.size()<1}">
						    <li class="comment even thread-even depth-1" id="li-comment-2">
									<article id="comment-2">

										<div class="comment-meta">

											<h5 class="author">
												<cite class="fn"> <a href="#" rel="external nofollow"
													class="url"></a>
											</h5>

											<p class="date">
												<a href="#"> <time datetime="2013-02-26T13:18:47+00:00"></time>
												</a>
											</p>

										</div>
										<!-- end .comment-meta -->

										<div class="comment-body">
											<p>亲！暂时没有回复哦！ </p>
											<button class="layui-btn layui-btn-primary" onclick="addNoComment()" style="float: right;">添加评论</button>
											<button class="layui-btn layui-btn-primary btnSee" onclick="seeNoComment()" style="float: right;">查看评论</button>
										</div>
										<!-- end of comment-body -->
									</article>
								</li>
						</c:if>
						<c:if test="${pdQid.data.size()>0}">
							<c:forEach items="${pdQid.data}" var="ans">
								<li class="comment even thread-even depth-1" id="li-comment-2">
									<article id="comment-2">

										<a href="#"> <img alt=""
											src="http://1.gravatar.com/avatar/50a7625001317a58444a20ece817aeca?s=60&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D60&amp;r=G"
											class="avatar avatar-60 photo" height="60" width="60">
										</a>

										<div class="comment-meta">

											<h5 class="author">
												<cite class="fn"> <a href="#" rel="external nofollow"
													class="url">${ans.userName}</a>
											</h5>

											<p class="date">
												<a href="#"> <time datetime="2013-02-26T13:18:47+00:00">${ans.adate}</time>
												</a>
												<span style="float: right; cursor: pointer;" class="like-count layui-icon layui-icon-praise praiseAnswer${ans.aid}" onclick="praiseAnswer(${ans.aid})" >${ans.aPraise}</span>
											</p>

										</div>
										<!-- end .comment-meta -->

										<div class="comment-body">
											<p>${ans.content}</p>
											<button class="layui-btn layui-btn-primary" onclick="addComment(${ans.aid})" style="float: right;">添加评论</button>
											<button class="layui-btn layui-btn-primary btnSee${ans.aid}" onclick="seeComment(${ans.aid})" style="float: right;">查看评论</button>
										</div>
										<!-- end of comment-body -->
									</article>
									<div class="msg${ans.aid}" style="display: none;">
										<input style="height: 30px; width: 550px;" type="text" required="required" class="form-control inputComment${ans.aid}" placeholder="请输入你的评论" name="content" id="content" value="" />
										<button style="position: relative; top: -5px;" class="layui-btn layui-btn-normal" onclick="submitComment(${ans.aid})">提交评论</button>		
									</div> 
									<ul class="children seeMsgLoading">
									</ul>
									  <ul class="children seeMsg${ans.aid}" style="display: none;">
										   
									  </ul>
								</li>


							</c:forEach>
							<!-- 回答结束 -->
							</c:if>

						</ol>
						
				        <div id="pageAnswer"></div>

						<div id="respond">

							<h3>回答该问题</h3>

							<div class="cancel-comment-reply">
								<a rel="nofollow" id="cancel-comment-reply-link" href="#"
									style="display: none;">Click here to cancel reply.</a>
							</div>


							<form id="commentform">


								<p class="comment-notes">
									您的email可以选填，* 为必填项<span class="required"></span>
								</p>

								<div>
									<label for="userName">名字 </label> <input class="span4"
										type="text" required="required" name="userName" id="userName" value="" size="22">
								</div>

								<div>
									<label for="email">Email</label> <input class="span4"
										type="email" name="email" id="email" value="" size="22">
								</div>

								<div>
									<label for="userTel">电话号码 </label> <input class="span4"
										type="text" required="required" name="userTel" id="userTel" value="" size="22">
								</div>


								<div>
									<label for="content">回答的内容  *</label>
									<textarea class="span8" name="content" id="Answercontent" cols="58"
										rows="10"  required="required"></textarea>
								</div>
                                <br/>
								<div>
									<input class="btn btn-success" type="button" id="btnSubmitAnswer"
										value="提交回答">
								</div>

							</form>

						</div>

					</section>
				</div>
				<aside class="span4 page-sidebar">

					<section class="widget">
						<div class="support-widget">
							<h3 class="title userTitle">游客</h3>
							<p class="intro">游客暂时只有预览的功能哦！ 查看更多详情请登录。。。。</p>
						</div>
					</section>

                    <section class="widget">
							<h3 class="title">Tags</h3>
							<div class="tagcloud">
								<a href="#" class="btn btn-mini">java</a>
								<a href="#" class="btn btn-mini">php</a>
								<a href="#" class="btn btn-mini">pyhon</a>
								<a href="#" class="btn btn-mini">嵌入式</a>
								<a href="#" class="btn btn-mini">css</a>
								<a href="#" class="btn btn-mini">html5</a>
								<a href="#" class="btn btn-mini">JavaScript</a>
								<a href="#" class="btn btn-mini">jquery</a>
								<a href="#" class="btn btn-mini">bootstrqp</a>
								<a href="#" class="btn btn-mini">header</a>
								<a href="#" class="btn btn-mini">images</a>
								<a href="#" class="btn btn-mini">plugins</a>
								<a href="#" class="btn btn-mini">setting</a>
								<a href="#" class="btn btn-mini">templates</a>
								<a href="#" class="btn btn-mini">theme</a>
								<a href="#" class="btn btn-mini">time</a>
								<a href="#" class="btn btn-mini">videos</a>
								<a href="#" class="btn btn-mini">website</a>
								<a href="#" class="btn btn-mini">wordpress</a>
							</div>
						</section>
				</aside>
				<!-- end of sidebar -->
			</div>
		</div>
	</div>
	<!-- End of Page Container -->

	<!-- Start of Footer -->
	<footer id="footer-wrapper">
		<div id="footer" class="container">
			<div class="row">

				<div class="span3">
					<section class="widget">
						<h3 class="title">How it works</h3>
						<div class="textwidget">
							<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
								sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
								aliquam erat volutpat.</p>
							<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation
								ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo
								consequat.</p>
						</div>
					</section>
				</div>

				<div class="span3">
					<section class="widget">
						<h3 class="title">Categories</h3>
						<ul>
							<li><a href="#" title="Lorem ipsum dolor sit amet,">Advanced
									Techniques</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet,">Designing
									in WordPress</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet,">Server
									&amp; Database</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet, ">Theme
									Development</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet,">Website
									Dev</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet,">WordPress
									for Beginners</a></li>
							<li><a href="#" title="Lorem ipsum dolor sit amet, ">WordPress
									Plugins</a></li>
						</ul>
					</section>
				</div>

				<div class="span3">
					<section class="widget">
						<h3 class="title">Latest Tweets</h3>
						<div id="twitter_update_list">
							<ul>
								<li>No Tweets loaded !</li>
							</ul>
						</div>
					</section>
				</div>

				<div class="span3">
					<section class="widget">
						<h3 class="title">Flickr Photos</h3>
						<div class="flickr-photos" id="basicuse"></div>
					</section>
				</div>

			</div>
		</div>
		<!-- end of #footer -->

		<!-- Footer Bottom -->
		<div id="footer-bottom-wrapper">
			<div id="footer-bottom" class="container">
				<div class="row">
					<div class="span6">
						<!-- Social Navigation -->
						<ul class="social-nav clearfix">
							<li class="linkedin"><a target="_blank" href="#"></a></li>
							<li class="stumble"><a target="_blank" href="#"></a></li>
							<li class="google"><a target="_blank" href="#"></a></li>
							<li class="deviantart"><a target="_blank" href="#"></a></li>
							<li class="flickr"><a target="_blank" href="#"></a></li>
							<li class="skype"><a target="_blank" href="skype:#?call"></a></li>
							<li class="rss"><a target="_blank" href="#"></a></li>
							<li class="twitter"><a target="_blank" href="#"></a></li>
							<li class="facebook"><a target="_blank" href="#"></a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!-- End of Footer Bottom -->

	</footer>
	<!-- End of Footer -->

	<a href="#top" id="scroll-top"></a>
	<script type="text/javascript">
    	  
          function seeComment(aid){
        	 console.log(${pdQid.totalPage});
        	  if(${userTopLogin==null}){
      			layer.msg('亲，需要登录您才有权限哦！', {
  					time : 2000,
  					icon:5
  			  });
      		}else{
      			layui.use('flow', function(){
      			  var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
      			  var flow = layui.flow;
      			  flow.load({
      			    elem: ".seeMsg"+aid //指定列表容器
      			    ,done: function(page, next){ //到达临界点（默认滚动触发），触发下一页
      			      var lis = [];
      			      //以jQuery的Ajax请求为例，请求下一页数据（注意：page是从2开始返回）
        	  console.log(1111);
        	  $.ajax({
     			 url:"sas.do?op=seeComment",
     			 type:"get",
     			 data:{
     				 "aid":aid,
     				 "qId":${answerQid}
     			 },
     			 dataType:"text",
     			 success:function(data){
     				console.log(data);
     				var one = data.lastIndexOf("]");
  		            var totalPage=data.substring(one+1);
       			    var result=data.substring(0,one+1);
       			    var array = JSON.parse(result);
     				if(array.length>0){
     				$.each(array, function(index, comment) {
     					var text = "";
     					text += "<li";
     					text += "											class=\"comment byuser comment-author-saqib-sarwar bypostauthor odd alt depth-2 loadCom\"";
     					text += "											id=\"li-comment-3\">";
     					text += "											<article id=\"comment-3\">   ";
     					text += "										        <hr>";
     					text += "												<a href=\"#\"> <img alt=\"\"";
     					text += "													src=\"images/temp/man.png\"";
     					text += "													class=\"avatar avatar-60 photo\" height=\"60\" width=\"60\">";
     					text += "												</a>";
     					text += "";
     					text += "												<div class=\"comment-meta\">";
     					text += "													<h5 class=\"author\">";
     					text += "														<cite class=\"fn\">saqib sarwar</cite> - <a";
     					text += "															class=\"comment-reply-link cu${ans.aid}\" href=\"#\">"+comment.userName+"</a>";
     					text += "													</h5>";
     					text += "";
     					text += "													<p class=\"date\">";
     					text += "														<a href=\"#\"> <time class=\"cd${ans.aid}\"";
     					text += "																datetime=\"2013-02-26T13:20:14+00:00\">"+comment.cDate+"</time>";
     					text += "<span style=\"float: right; cursor: pointer;\" class=\"like-count layui-icon layui-icon-praise praiseComment"+comment.cId+"\" onclick=\"praiseComment("+comment.cId+")\">"+comment.cPraise+"</span>";
     					text += "														</a>";
     					text += "													</p>";
     					text += "";
     					text += "												</div>";
     					text += "												<!-- end .comment-meta -->";
     					text += "";
     					text += "												<div class=\"comment-body\">";
     					text += "													<p class=\"cc${ans.aid}\">"+comment.cContent+"</p>";
     					text += "												</div>";
     					text += "												<!-- end of comment-body -->";
     					text += "";
     					text += "											</article>";
     					text += "											<!-- end of comment -->";
     					text += "";
     					text += "										</li>";
     					text += "<div id=\"pageComment\"></div>";


    					//$(".seeMsg"+aid).append(text);
     					lis.push(text);
    				});
     				next(lis.join(''), page < totalPage); 
     				$(".seeMsg"+aid).slideToggle(1000);
     			  }else{
     				 layer.msg('暂时没有评论哦！ 请添加评论', {
							time : 3000
					 });
     			  }
     			 }
     		 });
      			    }
      			 });
      			 });
      		}
          }
          function addComment(aid){
    		  if(${userTopLogin==null}){
      			layer.msg('亲，需要登录您才有权限哦！', {
  					time : 2000,
  					icon:5
  			  });
      		}else{
        	  console.log(aid);
        	  $(".msg"+aid).slideToggle(2000);
      		}
          }
    	  function addNoComment(){
    		  if(${userTopLogin==null}){
      			layer.msg('亲，需要登录您才有权限哦！', {
  					time : 2000,
  					icon:5
  			  });
      		}else{
      			layer.msg('您好！暂时没有回复内容，所以不能提问哦！，您可以回答此问题', {
  					time : 2000
  			  });
      		}
          }
          function submitComment(aid){
        	  console.log(1111);
        	  $.ajax({
     			 url:"sas.do?op=insertComment",
     			 type:"post",
     			 data:{
     				 "cContent":$(".inputComment"+aid).val(),
     				 "aid":aid,
     			     "qId":${answerQid}
     			 },
     			 success:function(data){
     				 if(data=="false"){
     					 layer.msg('提交失败，请重新提交', {
 								time : 2000
 						 });
     				 }else{
     					 layer.msg('提交成功，感谢你的评论！！！！ 请查看', {
 								time : 3000
 						 });
     					 $(".seeMsg"+aid).load("http://localhost:8080/interlocution03/sas.do?qId=329 .loadCom");
     				 }
     			 }
     		 });
          }
          function seeNoComment(aid){
          	 console.log(${pdQid.totalPage});
          	  if(${userTopLogin==null}){
        			layer.msg('亲，需要登录您才有权限哦！', {
    					time : 2000,
    					icon:5
    			  });
        		}else{
        			layer.msg('您好！暂时没有回复内容，所以不能查看评论哦！，您可以回答此问题', {
   					time : 2000
   			  });
        		}
           }
    </script>
	<script type="text/javascript">
    $(function(){
	    if(${userTopLogin==null}){
		   $("#tourist").text("游客");
		   $("#topUserIfm").hide();
		   console.log(11111);
	    }else{
	       $("#tourist").css("display","none");
		   $("#topUserIfm").show();
		   $("#topLogin").text("${userTopLogin.userName}");
		   $(".userTitle").text("${userTopLogin.userName}");
		   $(".intro").text("${userTopLogin.userIntroduce}");
	    }
    });
    </script>
    <script type="text/javascript">
         $(function(){
        	 console.log(${userTopLogin.userId});
              $("#btnSubmitAnswer").click(function(){
            	  if(${userTopLogin==null}){
          			layer.msg('亲，需要登录您才有权限哦！', {
      					time : 2000,
      					icon:5
      			  });
          		}else{
          		   console.log($("#Answercontent").val());
          		  if($('#Answercontent').val().length<10){
          			layer.msg('亲，内容必须填写哦！并且长度要大于10！', {
      					time : 2000,
      					icon:5
      			     });
          		  }else{
            	  $.ajax({
  					url : "sas.do?op=insertAnswer",
  					type : "post",
  					data : {
  						"content" : $("#Answercontent").val(),
  						"qId" : ${answerQid}
  					},
  					success : function(data) {
  						if (data == "false") {
  							layer.msg('提交失败，请重新填写，并提交', {
  								time : 2000
  							});
  						} else {
  							layer.msg('提交成功，感谢您的回答！！', {
  								time : 3000, //20s后自动关闭
  								btn : [ '不用谢' ]
  							}, function() {
  								location.href = "sas.do?qId="+${answerQid};
  							});
  						}
  					}
  				});
          		  }
          		}
              });
         });
    </script>
    <script>
	layui.use('laypage', function() {
		var laypage = layui.laypage;
		var c = ${pdQid.total};
		var l = ${pdQid.pageSize};
		var p = ${pdQid.page};
		console.log(c)
		//执行一个laypage实例
		laypage.render({
			elem : 'pageAnswer' //注意，这里的 test1 是 ID，不用加 # 号
			,
			count : c, //数据总数，从服务端得到
			limit : l,
			limits:[5,10, 20, 30, 40, 50],
			skip : '#5e7cdf',
			layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'],
			curr : function() {
				var page = p; // 当前页(后台获取到的)
				return page ? page : 1; // 返回当前页码值
			}(),
			jump : function(obj, first) {
				if (!first) {
					location.href = "sas.do?qId="+${answerQid} + "&page=" + obj.curr+"&pageSize="+obj.limit
							+ "&keywords=" + $("#keywords").val();
				}
			}
		});
	});
	</script>
	<script type="text/javascript">
        $(function(){
        	var login="";
        	$("#topLogin").click(function(){

            	login = layer.open({
    				  type: 2,
    				  title:'亲，登录可以查看更多信息哦!!!!',
    				  anim: 3,
    				  time:60000,
    				  content: 'login_top.jsp',
    				  area: ['300px', '300px'],
    				  maxmin: true
    			});
        	});
        	var switchUser="";
        	$("#switchUser").click(function(){

        		switchUser = layer.open({
    				  type: 2,
    				  title:'亲，请登录你要切换的账号哦！！',
    				  anim: 3,
    				  time:60000,
    				  content: 'login_top.jsp',
    				  area: ['300px', '300px'],
    				  maxmin: true
    			});
        	});
        });
    </script>
    <script type="text/javascript">
    $(function(){
    	 $("#btnSearchAnswer").click(function(){
    		/*  location.href="QuestionTopServlet?op=queryQuestion_timeSort&req=frontList&nameLike="+$(""); */
    		 if(${userTopLogin==null}){
     			layer.msg('亲，需要登录您才有权限哦！', {
 					time : 2000,
 					icon:5
 			  });
     		}else{
    		 $.ajax({
    			 url:"QuestionTopServlet?op=queryQuestion_timeSort",
    			 type:"post",
    			 data:{
    				 "nameLike":$("#nameLikeAnswer").val()
    			 },
    			 success:function(data){
    				 if(data=="false"){
    					 layer.msg('亲，搜不到你输入的关键字哦！ 请输入其他关键字', {
								time : 2000
						 });
    				 }else{
    					 layer.msg('搜索成功，有效的关键字！！！！', {
								time : 3000
						 },function(){
							 location.href="QuestionTopServlet?op=queryQuestion_timeSort&req=frontList&nameLike="+$("#nameLikeAnswer").val();
						 });
    					 
    				 }
    			 }
    		 });
     		}
    	 });
    });
    </script>
    
    <script type="text/javascript">
         $(".praiseQuestion").click(function(){
        	 var qPra=parseInt($(".praiseQuestion").html());
        	 if(${userTopLogin==null}){
       			layer.msg('亲，需要登录您才有权限哦！', {
   					time : 2000,
   					icon:5
   			  });
       		}else{
        	 $.ajax({
     			 url:"QuestionTopServlet?op=updatePraise",
     			 type:"post",
     			 data:{
     				 "qPraise":qPra+1,
     			     "qId":${pdNo.data[0].qId}
     			 },
     			 success:function(data){
     				console.log(data);
     				$(".praiseQuestion").html(data);
     			 }
     		 });
       		}
         });
         function praiseAnswer(aid){
        	 var qPra=parseInt($(".praiseAnswer"+aid).html());
        	 if(${userTopLogin==null}){
       			layer.msg('亲，需要登录您才有权限哦！', {
   					time : 2000,
   					icon:5
   			  });
       		}else{
        	 $.ajax({
     			 url:"sas.do?op=updateAnswerPraise",
     			 type:"post",
     			 data:{
     				 "aPraise":qPra+1,
     			     "aid":aid
     			 },
     			 success:function(data){
     				console.log(data);
     				$(".praiseAnswer"+aid).html(data);
     			 }
     		 });
       		}
         }
         function praiseComment(cId){
        	 var qPra=parseInt($(".praiseComment"+cId).html());
        	 if(${userTopLogin==null}){
       			layer.msg('亲，需要登录您才有权限哦！', {
   					time : 2000,
   					icon:5
   			  });
       		}else{
        	 $.ajax({
     			 url:"sas.do?op=updateCommentPraise",
     			 type:"post",
     			 data:{
     				 "cPraise":qPra+1,
     			     "cId":cId
     			 },
     			 success:function(data){
     				console.log(data);
     				$(".praiseComment"+cId).html(data);
     			 }
     		 });
       		}
         }
    </script>
    <script>
       layui.use(['rate'], function(){
          var rate = layui.rate;
   
         //渲染
          rate.render({
          elem: '#star',
          length: 10,
          value: 1,
          theme: '#1E9FFF',
          half:true
          ,choose: function(value){
        	    if(value > 0)
        	    layer.msg('感谢您的星星！！', {
       					time : 2000
       		    });
        	    
        	  }
          });
       });
  </script>
</body>
</html>